package com.by.controller;

import com.by.bean.Category;
import com.by.common.bean.ResultBean;
import com.by.common.controller.BaseController;
import com.by.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Hzy
 * @version 1.0
 * @date 2025/2/19  11:37
 * @description
 * @since jdk11
 */
@RestController
@RequestMapping("/api")
@Api(tags = "客户分类")
public class CategoryController extends BaseController {

    @Autowired
    CategoryService categoryService;

    @ApiOperation("查询客户分类")
    @GetMapping("/category")
    public ResultBean query() {
        List list = categoryService.query();
        return success("客户分类列表", list);
    }

    @ApiOperation("编辑客户分类")
    @PutMapping("/category")
    public ResultBean update(Category category) {
        int rs = categoryService.update(category);
        return updateResult(rs);
    }
}
